
*******************************************************************************
****						Appendix Table G.21	- REGRESSION OF TOTAL TOLL ****
****			ON TIME DIFFERENTIALS: RESTRICTED TIME WINDOWS			*******
*******************************************************************************
use ".\data\clean\I10W_laneuse_dataset_15nov14_wcensus", clear
merge m:1 date hour using ".\data\clean\HV_ML_reliab.dta", keep(1 3) nogen 
gen reliabilityML=dist/p20_speedML-dist/p50_speedML
gen reliabilityHV=dist/p20_speedHV-dist/p50_speedHV
gen reliability_diff=reliabilityML-reliabilityHV

*WTP calculation
gen TT_dif_hr=dist/MLspeed-dist/ELspeed
gen WTP2=charged_toll/TT_dif_hr
drop if ELspeed==.
drop if TT_dif_hr==.
drop if holiday==1
la var TT_dif_hr "Time in Hours"
drop if dow==0|dow==6
keep if acct_type=="PRIVATE"&occupancy~="HOV-3"
keep if hour>4 & hour<9
replace reliability_diff=0 if reliability_diff<0.01
keep if reliability_diff~=.
la var reliability_diff "Reliability"
est sto clear
reg charged_toll TT_dif_hr reliability_diff if TT_dif_hr>=3/60 & TT_dif_hr<=5/60, cluster(rt_id)
est sto a0

reg charged_toll TT_dif_hr reliability_diff if TT_dif_hr<3/60 & TT_dif_hr>0, cluster(rt_id)
est sto a1

esttab  a0 a1  using ".\results\appendix\tabs\ATG21.csv", replace  ///
	cells(b(star fmt(%9.2f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) ///
	stats(r2 N ,fmt(%9.2f %9.0f) ) label ///
	order(_cons TT_dif_hr reliability_diff) keep( TT_dif_hr _cons reliability_diff) ///
	mtitle(I II ) nonumbers nodepvars
	
insheet using ".\results\appendix\tabs\ATG21.csv", comma clear
export excel using ".\results\appendix\AppendixFigsTabs.xlsx", ///
	sheet("Appendix Table G.21", replace)
